# -*- coding: utf-8 -*-
"""
______________________________
  Author: 安智军
  Email :  1010666711@qq.com
   Time : 2023/8/6 16:00
    File: contact_page.py
Software: PyCharm
______________________________
"""
from .base_page import BaesPage
from selenium.webdriver.common.by import By


class ContactPage(BaesPage):
    """
    通讯页面 有新增用户、删除用户的功能
    """
    # 用户名称
    # USERNAME = [By.XPATH, '//input[@id="username"]']
    USERNAME = (By.XPATH, '//input[@id="username"]')
    #账号
    MEMBER_ACCTID = (By.XPATH, '//*[@id="memberAdd_acctid"]')
    # MEMBER_ACCTID = [By.XPATH, '//*[@id="memberAdd_acctid"]']
    # 手机号
    MEMBER_PHONE = (By.XPATH, '//input[@class="qui_inputText ww_inputText ww_telInput_mainNumber"]')
    # MEMBER_PHONE = [By.XPATH, '//input[@class="qui_inputText ww_inputText ww_telInput_mainNumber"]']
    # 保存按钮
    # SAVE_BUTTON = (By.XPATH, '//a[@class="qui_btn ww_btn js_btn_save"]')
    SAVE_BUTTON = (By.CSS_SELECTOR, "a.qui_btn.ww_btn.js_btn_save")
    # SAVE_BUTTON = [By.XPATH, '//a[@class="qui_btn ww_btn js_btn_save"]']

    def save_member(self, username, acctid, phone):
        """
        保存成员逻辑
        :return:

        """
        self.do_send_keys(username,self.USERNAME)
        # self.do_send_keys(self.MEMBER_ACCTID, )
        self.do_send_keys(acctid,self.MEMBER_ACCTID)
        # self.do_send_keys(self.USERNAME, phone)
        self.do_send_keys(phone,self.USERNAME )
        # self.do_click(self.SAVE_BUTTON)
        self.do_find(self.SAVE_BUTTON).click()
        return self

    def delete_member(self):
        """
        删除成员
        :return:
        """
        pass
